<template>
  <el-form :inline="true" :model="loginUser1" class="demo-form-inline">
    <el-form-item label="账号">
      <el-input v-model="loginUser1.empId" placeholder="账号"></el-input>
    </el-form-item>
    <el-form-item label="密码">
      <el-input v-model="loginUser1.empName" placeholder="密码"></el-input>
    </el-form-item>
    <el-form-item>
      <el-button type="primary" @click="onSubmit">查询</el-button>
    </el-form-item>
  </el-form>
</template>

<script>
export default {
  name: 'login',
  data() {
    return {
      loginUser1: {
        empId: '',
        empName: ''
      }
    }
  },
  methods: {
    onSubmit() {
      console.log(this.loginUser1);
      let that = this;
      this.$ajax.post("http://localhost:8081/emp/login?empId="+this.loginUser1.empId+"&empName="+this.loginUser1.empName).then(resp=>{
        if(resp.data.code===200){
          this.$router.push("/main")
          sessionStorage.setItem("token",resp.data.data)
        }else{
          this.$message.error(resp.data.msg)
        }

      })
    }
  }
}
</script>

<style scoped>

</style>